package prefetch

import (
	"log"
	"time"
)

// FileAccessEvent 表示一个文件访问事件
type FileAccessEvent struct {
	Path      string
	Timestamp time.Time
}

// Monitor 模拟事件源
type Monitor struct {
	ch chan FileAccessEvent
}

func NewMonitor() *Monitor {
	return &Monitor{ch: make(chan FileAccessEvent, 100)}
}

func (m *Monitor) Events() <-chan FileAccessEvent {
	return m.ch
}

// 模拟捕获
func (m *Monitor) SimulateAccess(path string) {
	m.ch <- FileAccessEvent{Path: path, Timestamp: time.Now()}
	log.Printf("[monitor] access: %s", path)
}
